<script lang="ts">
export default {
  name: "RepositoryCompFormHeader"
}
</script>

<template>
  <el-form ref="queryFormRef" :inline="true" :model="dataState.queryParams">
    <el-form-item prop="keyWord">
      <el-input v-model="dataState.queryParams.keyWord" clearable placeholder="关键字" @keyup.enter="handleQuery"/>
    </el-form-item>

    <el-form-item>
      <el-button :icon="Search" type="primary" @click="handleQuery">搜索</el-button>
      <el-button :icon="Refresh" @click="resetQuery">重置</el-button>
    </el-form-item>
  </el-form>
</template>

<script lang="ts" setup>
import {onMounted, reactive} from "vue";

import {Search, Refresh} from '@element-plus/icons-vue';
import {RepoCompQueryParam} from "@/api/repo/comp/cloud/dev-template/types";

const emit = defineEmits(['query', 'scan', 'restart', 'delete', 'download']);// 定义组件的事件通知


// 数据状态：定义
let dataState = reactive({
  // 组件类型选项
  componentTypeOptions: [] as OptionType[],
  // 组件类型选项
  statusTypeOptions: [] as OptionType[],
  // 查询参数
  queryParams: {modelType: 'decoder', pageNum: 1, pageSize: 10} as RepoCompQueryParam,
});

function handleList() {
  emit('query', 'header', dataState.queryParams);
}

function handleQuery() {
  emit('query', 'header', dataState.queryParams);
}

function resetQuery() {
  emit('query', 'header', dataState.queryParams);
}

/**
 * 响应页面安装：页面的初始化工作
 */
onMounted(() => {

});

</script>
